#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os

from utils.file_util import get_desk_top_p

dir = get_desk_top_p() + '\\333'

originalName = '()'
replaceName = ''


def rename(path1):
    files = os.listdir(path1)
    for file in files:
        if os.path.isdir(path1 + '\\' + file):
            rename(path1 + '\\' + file)
        else:
            files2 = os.listdir(path1 + '\\')
            for file1 in files2:
                if originalName in file1:
                    n = str(path1 + '\\' + file1.replace(originalName, replaceName))
                    n1 = str(path1 + '\\' + str(file1))
                    try:
                        os.rename(n1, n)
                    except IOError:
                        continue


rename(dir)
